package com.qiangesoft.voice2text.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 阿里云鉴权client配置
 *
 * @author qiangesoft
 * @date 2024-04-11
 */
@Configuration
public class AliyunConfig {

    /**
     * IAcsClient
     */
    @Bean
    public IAcsClient acsClient(AliyunProperties aliyunProperties) {
        // 创建DefaultAcsClient实例并初始化
        DefaultProfile.addEndpoint(aliyunProperties.getRegionId(), aliyunProperties.getProduct(), aliyunProperties.getDomain());
        DefaultProfile profile = DefaultProfile.getProfile(aliyunProperties.getRegionId(), aliyunProperties.getAccessKeyId(), aliyunProperties.getAccessKeySecret());
        return new DefaultAcsClient(profile);
    }

}
